<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>

    <div>
        <i></i>
        <b></b>
        <span></span>
    </div>

    <script>

        var div = document.getElementsByTagName('div')[0];

        var children = div.children;
        var len = children.length;
        for(var i = len - 2; i >= 0; i --) {
            div.appendChild(children[i]);
        }


    </script>




<!-- 
    <script>

        Element.prototype.insertAfter = function (targetNode, afterNode) {
            //  insertAfter, 和insertBefore类似
            var theNextNode;
            if (afterNode.nextElementSibling) {
                theNextNode = afterNode.nextElementSibling;
            } else {
                theNextNode = afterNode.nextSibling;
                while (theNextNode !== null && theNextNode.nodeType != 1) {
                    theNextNode = theNextNode.nextSibling;
                }
            }
            if (theNextNode === null) {
                this.appendChild(targetNode);
            } else {
                this.insertBefore(targetNode, theNextNode);
            }
        }

        var div = document.getElementsByTagName('div')[0],
            b = document.getElementsByTagName('b')[0],
            span = document.getElementsByTagName('span')[0];

        var p = document.createElement('p');

        div.insertAfter(p, b);
        div.insertAfter(p, span);


    </script> -->
</body>
</html>